package fcl.mylife;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class MyItemizedOverlay extends BalloonItemizedOverlay<OverlayItem> {

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	private Context mContext;

	public MyItemizedOverlay(Drawable defaultMarker, MapView mapView) {
		super(boundCenter(defaultMarker), mapView);
	    mContext = mapView.getContext();
		
	}

	public void addOverlay(OverlayItem overlay) {
	    mOverlays.add(overlay);
	    populate();
	}
	
	@Override
	protected OverlayItem createItem(int i) {
	  return mOverlays.get(i);
	}
	
	
	

	@Override
	public int size() {
		return mOverlays.size();
	}
	
	
//	@Override
//	protected boolean onTap(int index) {
//	
//		
//	  ((BalloonItemizedOverlay<?>)this).onTap(index);
//	  return true;
//	}
	
	void clearOverlay() {
		mOverlays.clear();
		populate();
     }
	
	
	
	

}
